Your reassembler must implement the RTPRssmInitialize function. When initialized, your reassembler is passed an RTPRssmInitParams struct containing three initialization parameters:
struct RTPRssmInitParams {
UInt32 reserved;
UInt8 payloadType;
UInt8 pad[3];
TimeBase timeBase;
TimeScale controlTimeScale;
};
typedef struct RTPRssmInitParamsRTPRssmInitParams;
During initialization, your reassembler should open a stream handler of the appropriate type. For example, if your reassembler works with H.261 packets, it should open a video stream handler. Stream handler types are specified in the same manner as track types (Video is videoMediaType, and so on). There are currently stream handlers for audio, video, text, and MIDI.
Your reassembler opens a stream handler by calling RTPRssmNewStreamHandler . You must specify the stream handler type when you open it. If your reassembler handles multiple media types, it can open a stream handler later, after it learns what kind of media is in the stream.
You should initialize the sample description of the stream handler when you open it, if possible. It can be set or changed later if necessary. The stream handler will be unable to process any data until its sample description is set.
Your reassembler should also initialize the timescale of the stream handler at this time. If your reassembler needs to get the timescale from the stream, it can monitor incoming packets and set the timescale when it is known. (No chunks will be sent to the stream handler until its timescale is set).
During initialization, your reassembler should call RTPRssmSetCapabilities with any initial flags to control the base reassembler's default behaviors, such as kRTPRssmEverySampleAChunkFlag or kRTPRssmTrackLostPacketsFlag .
You should also call SetPayloadHeaderLength at this time if you know the payload header length for your packets.
A typical reassembler initialization function might look like this:
EXTERN_API( ComponentResult )
RTPRssmOVAL_Initialize(
RTPHOVALGlobalsPtrinGlobals,
RTPRssmInitParams *inInitParams )
{
#pragma unused(inInitParams)
ComponentResulterr = noErr;
ImageDescriptionHandleimageDesc;
SInt32 flags = 0;
inGlobals->fTimeScale = kOVALRTPTimeScale;
flags = kRTPRssmQueueAndUseMarkerBitFlag + kRTPRssmTrackLostPacketsFlag;
err = RTPRssmSetCapabilities(inGlobals->delegateComponent, flags, -1L );
if (err == noErr) {
imageDesc = __GetMyImageDesc( inGlobals );
if( imageDesc )
{
err = RTPRssmNewStreamHandler(inGlobals->delegateComponent,
VideoMediaType, ( SampleDescriptionHandle ) imageDesc,
inGlobals->fTimeScale, NULL);
}
else
err = memFullErr;
}
return err;
}
| Previous | Chapter Contents | Chapter Top | Next |